# Simple While Loop

let a = 1
while test $a -lt 10
    echo $a
    let a += 1
end

# While Loop With If Conditions

let a = 1
while test $a -lt 10
    if test $a -eq 5
        echo found 5
    else
        echo $a
    end
    let a += 1
end

# Nested While Loops

let outer_count = 1;
while test $outer_count -lt 4
    echo "outer loop #$outer_count"
    let outer_count += 1
    let inner_count = 1
    while test $inner_count -lt 4
        echo "    inner loop #$inner_count"
        let inner_count += 1
    end
end

# Chained predicates

let first = 1
let second = 1
while test $first -lt 13 && test $second -lt 20
	echo $first $second
	let first second = $second $((first + second))
end
